package cn.kai.service.impl;

import cn.kai.json.flow.FlowJson;
import cn.kai.process.flow.core.FlowChain;
import cn.kai.process.flow.core.FlowEngine;
import cn.kai.service.FlowService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Map;

/**
 Author: cKnight
 Date: 2025/1/23
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class FlowServiceImpl implements FlowService {
    private final FlowEngine flowEngine;

    @Override
    public Object registerFlow(FlowJson flowJson) {
        flowEngine.registerChain(flowJson);
        return null;
    }

    @Override
    public Map<String, FlowChain> getFlow() {
        return flowEngine.getAllChain();
    }

    @Override
    public Object execute(String name) {
        flowEngine.execute(name);
        return null;
    }

}
